package com.google.pages;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

import com.google.data.UserData;


public class LogInPage extends Page {
	
	@FindBy(name = "Email")
	WebElement eMailAddressField;
	
	@FindBy(name = "Passwd")
	WebElement passwordField;
	
	@FindBy(name = "PersistentCookie")
	WebElement rememberMeCheckBox;
	
	@FindBy(name = "signIn")
	WebElement signInButton;
		
	public LogInPage(WebDriver driver) {
		super(driver);
	}
	
	public void open() {
		driver.get("https://accounts.google.com");
	}
	
	public HomePage signIn(UserData user) {
		completeField(eMailAddressField, user.login);
		completeField(passwordField, user.password);
		signInButton.click();
		return PageFactory.initElements(driver, HomePage.class);
	}
	

	

}
